home *** CD-ROM | disk | FTP | other *** search
- DWArcs version 1.2
- Written by James R. Davis
- (C) Copyright 1993 - All Rights Reserved
-
- While writing a program one day I came across a need for reading in filenames
- contained within archives. This PowerBASIC library is something I whipped up
- in order to fulfill that need. It contains only 4 routines and one variable
- but I'm sure you'll find this to be a very helpful addition to your PowerBASIC
- toolbox.
-
- PRELIMINARIES
- -------------
-
- You should find the following files in this archive:
-
- DWADEMO.BAS - Demo source for using the library
- DWARCS.DOC - This doc file
- DWSRC.EXE - For registered users
- DWARCS.SRC - Data for DWSRC.EXE
- DWARCS2F.PBU - PBU for PB 2.10f
- DWARCS3A.PBU - PBU for PB 3.00a
- DWARE.DOC - Complete list of DavisWARE available
- FILE_ID.DIZ - Description file for BBS's
- ORDER.FRM - Form for registering this program
-
- If any of these files are missing, you can call my BBS the Programmer's
- Mega-Source at (516) 737-4637 and get the latest version.
-
- At this time, this library handles the following archive formats:
-
- ARC - PKARC up to version 5.10
- ARJ - ARJ up to version 2.39a BETA
- LZH - LHARC up to version 1.13c
- PAK - PKPAK up to version 2.51
- ZIP - PKZIP up to version 2.04G
- ZOO - ZOO up to version 2.1
-
- If you find an archive format not supported here, let me know and I'll try to
- work it into the next version.
-
- The following PBU's included with this program are for the different
- PowerBASIC versions:
-
- DWARCS2F.PBU - For version 2.10f of PowerBASIC
- DWARCS3A.PBU - For version 3.00a of PowerBASIC
-
- A version for 3.00b of PowerBASIC will be released soon.
-
- Now on to the library. See the demo program for actual program use and for
- more extensive examples. There are 3 Functions, 1 Subroutine and 1 Variable
- that this library can handle. Here's the descriptions:
-
-
- DESCRIPTIONS
- ------------
-
- -------------------------------------------------------------------------------
- Net% VARIABLE Set to non-zero if working on a remote terminal of a network
- -------------------------------------------------------------------------------
- This variable when set to a non-zero number, will tell the rest of the
- functions that the program is running on a remote terminal of a network.
- This is accomplished simply by removing the drive letter from file names
- specified. When you set this variable, routines within the library will
- automatically do this for you. NOTE: You must declare this variable as PUBLIC
- in your source code.
-
- Syntax: Net% = -1
-
- Example:
-
- PRINT "Is this program running on a remote terminal of a network? (Y/n): ";
- A$ = INPUT$(1)
- A$ = UCASE$(A$)
- IF A$ = "N" THEN
- Net% = 0
- PRINT "N"
- ELSE
- Net% = -1
- PRINT "Y"
- END IF
-
-
- -------------------------------------------------------------------------------
- ArcFiles%() FUNCTION Returns number of files in an archive
- -------------------------------------------------------------------------------
- This function will return the total number of files within the archive name
- passed to it in File$. Will return -1 if archive file does not exist, -2 if
- file is not an archive supported.
-
- Syntax: A% = ArcFiles%(File$)
-
- Where File$ = The file name with or without drive and path of the
- archive you wish to get the information from.
-
- Example:
-
- A$ = "C:\TEMP\TEST.ZIP"
- A% = ArcFiles%(A$)
- IF A% = -1 THEN
- PRINT A$;" does not exist!"
- ELSEIF A% = -2 THEN
- PRINT A$;" is not supported!"
- ELSE
- PRINT "There are ";LTRIM$(STR$(A%));" file(s) in ";A$
- END IF
-
-
- -------------------------------------------------------------------------------
- ArcDir$() FUNCTION Returns first/subsequent filenames in archive
- -------------------------------------------------------------------------------
- This function acts like DIR$("*.*") in that it returns a the first filename
- within the archive specified in File$. Any subsequent calls to this routine
- will return the next filename found in the archive. ArcDir$ will return a
- null string if the archive does not exist, is not a supported archive or the
- last filename has been found in the archive.
-
- Syntax: A$ = ArcDir$(File$)
-
- Where File$ = Is the name with or without drive and path of the
- archive in which to use.
-
- Example:
-
- F$ = "C:\TEMP\TEST.ZIP"
- A$ = ArcDir$(F$)
- IF A$ = "" THEN
- PRINT F$;" does not exist or is not supported!"
- END IF
- WHILE A$ <> ""
- PRINT A$
- A$ = ArcDir$(F$)
- WEND
-
-
- -------------------------------------------------------------------------------
- ArcInfo() SUBROUTINE Returns specific data about file within an archive
- -------------------------------------------------------------------------------
- This subroutine will search an archive for filename. If found the file's
- date, time, size and compressed size will be returned. Otherwise, if not found, null
- strings will be returned.
-
- Syntax: CALL ArcInfo(File$,Arc$,FileDate$,FileTime$,FileSize$,CompSize$)
-
- Where File$ = The archive filename to use, can contain a drive
- and/or path. If filename does not exist or is not
- supported, File$ will be set to a null string.
- Arc$ = The file within the archive to get information for.
- If Arc$ is not found, all stirngs will be set to
- a null string. (eg: A$ = "") Must not contain a
- drive or pathname.
- FileDate$ = The file date of Arc$ in MM-DD-YY format
- FileTime$ = The file time of Arc$ in HH:MMa format
- FileSize$ = The actual file size before compression
- CompSize$ = The file size after compression
-
- Note: The file sizes are contained in strings to avoid having to
- assign a specific variable type to the function. Use VAL() to
- get the sizes into a variable after calling the subroutine.
-
- Example:
-
- F$ = "C:\TEMP\TEST.ZIP"
- A$ = "TEST.DOC"
- FF$ = F$
- CALL ArcInfo(FF$, A$, FD$, FT$, FS$, CS$)
- IF FF$ = "" THEN
- PRINT F$; " does not exist or is not supported!"
- END
- END IF
- IF FD$ = "" THEN
- PRINT A$; " does not exist in "; F$
- ELSE
- PRINT A$, FS$, CS$, FD$; " "; FT$; " ";
- PRINT USING$("###%", 100 - INT((100 / VAL(FS$)) * VAL(CS$)))
- END IF
-
-
- -------------------------------------------------------------------------------
- SearchArc%() FUNCTION Will search an archive for a specified filename
- -------------------------------------------------------------------------------
- This function will allow you to search an archive for a specified filename.
- If the filename was found in the archive, this function will return a non-zero
- number, or 0 if the filename was not found. This function does not check to
- see if the archive exists.
-
- Syntax: A% = SearchArc%(File$, Search$)
- Where File$ = The filename and/or drive and path fo the archive to
- search. This function does not check to see if this
- file exists.
- Search$ = Is the filename to search for within the archive. If
- it is found, a non-zero number is returned. If not,
- 0 is returned.
-
- Example:
-
- F$ = "C:\TEMP\TEST.ZIP"
- A$ = "FILE_ID.DIZ"
- A% = SearchArc%(F$, A$)
- IF A% THEN
- PRINT A$; " exists within ";F$
- ELSE
- PRINT A$; " does not exist within "; F$
- END IF
-
-
- REGISTRATION
- ------------
-
- Well, that about does it for the library... pretty simple right? Thought so.
- If you find this library of use, and would like the source code, the
- registration fee for this program is $15. Use the ORDER.FRM included with
- this library to register this library for a license to use it in your
- programs. If you have problems or questions about this library, call the
- Programmer's Mega-Source BBS at (516) 737-4637. Have fun and keep on
- programming!
-
- -=> James "The Garf!" Davis! <=-
-
-